#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    vector<int64_t> v(999168);
    v[1] = 1;
    for (int64_t i = v.size() - 1; i > 0; --i) {
        int64_t n = i;
        int64_t c = 0;
        while (true) {
            if (n % 2)
                n = 3 * n + 1;
            else
                n /= 2;
            ++c;

            if (n < v.size() && v[n]) {
                v[i] = c + v[n];
                break;
            }
        }
        // cout << i << ": " << v[i] << endl;
    }
    cout << distance(v.begin(), max_element(v.begin(), v.end())) << endl;
    // 837799
}